#ifndef RIVIAPALETTEMGR_H
#define RIVIAPALETTEMGR_H

#include <QMutex>
#include <QVector>
#include "opencv2/core.hpp"

class QImage;

class RIVIAPaletteMgr
{
public:
    static RIVIAPaletteMgr* getInstance();
    static void freeInstance();

private:
    RIVIAPaletteMgr();
    virtual ~RIVIAPaletteMgr();

private:
    static RIVIAPaletteMgr* m_pInstance;
    static QMutex m_lockMutex;

public:
    void setMainPalette(int channel, int degree); //channel R:0, G:1, B:2
    void setSidePalette(int channel);

    QImage getMainQImage();
    QImage getSideQImage();

    void setCurColor(int r, int g, int b);
    void setCurBackColor(int r, int g, int b);

    QVector<int> getCurColor() const;
    QVector<int> getCurBackColor() const;


private:
    cv::Mat m_MainPalette;
    cv::Mat m_SidePalette;
    QVector<int> m_CurColor;
    QVector<int> m_CurBackColor;
};

#endif // RIVIAPALETTEMGR_H
